Visual Basic (Declaration) | |
---|---|
Public Overloads Function Run( _ ByVal ParamArray arguments() As String _ ) As Integer |
Parameters
- arguments
Library/Library.Test/TestAssemblyRunner.cs
C# | Copy Code |
---|---|
using (AssemblyRunner runner = new AssemblyRunner(Exe)) { StringWriter wtr = new StringWriter(); StringWriter err = new StringWriter(); ProcessOutputEventHandler handler = delegate(object o, ProcessOutputEventArgs e) { if (e.Error) err.WriteLine(e.Data); else wtr.WriteLine(e.Data); }; runner.OutputReceived += handler; Assert.AreEqual(1, runner.Run("command-line-argrument")); Assert.AreEqual("std-err", err.ToString().Trim()); StringReader rdr = new StringReader(wtr.ToString()); Assert.AreEqual("WorkingDirectory = " + Environment.CurrentDirectory, rdr.ReadLine()); Assert.AreEqual("argument[0] = command-line-argrument", rdr.ReadLine()); Assert.AreEqual("std-input:", rdr.ReadLine()); Assert.AreEqual(null, rdr.ReadLine()); } |
VB.NET | Copy Code |
---|---|
Using runner As New AssemblyRunner(Exe) Dim wtr As New StringWriter() Dim err As New StringWriter() Dim handler As ProcessOutputEventHandler = Function(o As Object, e As ProcessOutputEventArgs) Do If e.[Error] Then err.WriteLine(e.Data) Else wtr.WriteLine(e.Data) End If End Function runner.OutputReceived += handler Assert.AreEqual(1, runner.Run("command-line-argrument")) Assert.AreEqual("std-err", err.ToString().Trim()) Dim rdr As New StringReader(wtr.ToString()) Assert.AreEqual("WorkingDirectory = " + Environment.CurrentDirectory, rdr.ReadLine()) Assert.AreEqual("argument[0] = command-line-argrument", rdr.ReadLine()) Assert.AreEqual("std-input:", rdr.ReadLine()) Assert.AreEqual(Nothing, rdr.ReadLine()) End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
AssemblyRunner ClassAssemblyRunner Members
Overload List